﻿CREATE procedure [dbo].[_tXML1]
as
declare @x xml
set @x =N'<myDataset>
  <tblClients>
    <id>1</id>
    <ClientName>Achiko</ClientName>
    <ClientSurname>Phanchulidze</ClientSurname>
    <birthdate>2008-06-10T00:00:00+03:30</birthdate>
  </tblClients>
  <tblClients>
    <id>2</id>
    <ClientName>Zurab</ClientName>
    <ClientSurname>Tkemaladze</ClientSurname>
    <birthdate>1970-05-10T00:00:00+03:30</birthdate>
  </tblClients>
  <tblClients>
    <id>3</id>
    <ClientName>Zvigen</ClientName>
    <ClientSurname>Katamadze</ClientSurname>
    <birthdate>1978-06-10T00:00:00+03:30</birthdate>
  </tblClients>
</myDataset>'

/*
SELECT a.b.value('.', 'int') AS result 
FROM   @x.nodes('/myDataset/tblClients/id') a(b)
*/

SELECT T.c.value('id[1]','int') as id,
T.c.value('ClientSurname[1]','nvarchar(200)') as ClientSurname,
T.c.value('ClientName[1]','nvarchar(200)') as ClientName
--T.c.value('birthdate[1]','datetime')
FROM   @x.nodes('/myDataset/tblClients') T(c)


